import { ResponseData } from '@/api/public'
import type { Trademark } from '../trademark/type'

// 单个Spu属性
export interface SpuData {
  id?: number
  spuName: string //spu属性名
  description: string //spu属性介绍
  category3Id: number | string //第三级分类id
  tmId: number | undefined //品牌id
  spuSaleAttrList: null | SpuAttr[] //某个spu的全部属性
  spuImageList: null | SpuImg[] //某个spu的全部商品图片
}
// Spu属性集合
export type Records = SpuData[]

// 获取SPU接口的返回类型
export interface GetSpuResData extends ResponseData {
  data: {
    records: Records
    total: number // 总计几个
    size: number // 当前页有几个
    current: number // 当前第几个
    searchCount: boolean
    pages: number // 总计几页
  }
}

// 获取所有品牌接口的返回类型
export interface AllTrademarks extends ResponseData {
  data: Trademark[]
}

// spu下商品图片
export interface SpuImg {
  id?: number
  imgName: string
  imgUrl: string
  createTime?: string
  updateTime?: string
  spuId?: number
  name?: string
  url?: string
}

// spu获取所有照片接口的返回类型
export interface ResSpuImgList extends ResponseData {
  data: SpuImg[]
}

// spu销售属性下的属性值
export interface SpuAttrValue {
  id?: number
  spuId?: number //spu的id
  baseSaleAttrId: number //属性id
  saleAttrValueName: string //属性值名称
  saleAttrName?: string //属性名
  isChecked?: null
}

// spu一个销售属性
export interface SpuAttr {
  id?: number
  spuId?: number
  baseSaleAttrId: number   //属性id
  saleAttrName: string    // 属性名称
  spuSaleAttrValueList: SpuAttrValue[]  //属性值列表
}

// 获取spu的销售属性列表接口的返回值
export interface ResSpuAttr extends ResponseData {
  data: SpuAttr[]
}

// 销售属性
export interface SaleAttr {
  id: number
  name: string
}

// 获取所有销售属性列表接口的返回值
export interface ResSaleAttr extends ResponseData {
  data: SaleAttr[]
}

// sku平台属性
export interface Attr{
  attrId: number | string,
  valueId: number | string,
  attrName: string,
  valueName: string
}

// sku销售属性
export interface saleAttr2{
  saleAttrId: number | string,
  saleAttrValueId: number | string,
  saleAttrName: string,
  saleAttrValueName: string
}

// 单个sku数据
export interface SkuData{
  category3Id: string | number,
  spuId: string | number,
  tmId: string | number,
  price: number,
  weight: number,
  skuName: string,
  skuDesc: string,
  skuAttrValueList?: Attr[],
  skuSaleAttrValueList: saleAttr2[],
  skuDefaultImg: string,
}

// 获取sku列表接口的返回值
export interface resSkuInfo extends ResponseData{
  data: SkuData[]
}